package org.terot.framework.fuzzy.instance;

import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Random;


/**
 * Created by IntelliJ IDEA.
 * User: steinlink
 * Date: Sep 22, 2008
 * Time: 3:03:13 PM
 * To change this template use File | Settings | File Templates.
 */
public class Instantiator {

    private Instantiator() {
        super();
    }

    /**
     * Create an unset fuzzy instance of the supplied class
     * @param cl the class to create a fuzzy instance of
     * @return an instance of class cl with pseudo-random parameters
     */
    public static<T> Collection<T> createUnsetFuzzyInstances(Class<T> cl) {
    	
    	ArrayList<T> list = new ArrayList<T>();
    	
    	// Add primitive instances;  if they exist, proceed no further
    	list.addAll(PrimitiveInstantiator.generatePrimitives(cl));
    	if (list.size() > 0) return list;

    	// Add instances from factory methods
    	list.addAll(FactoryMethodInstantiator.generateInstances(cl));
    	
    	// Add instances from constructors
    	list.addAll(ConstructorInstantiator.generateInstances(cl));
    	
    	return list;
    }
    


	public static<T> T createUnsetFuzzyInstance(Class<T> cl) {
		// TODO Auto-generated method stub
		return null;
	}
}
